﻿using System.Xml.Linq;

namespace TKT.Lifter.CIM.Lifter.TibcoMsg.Lifter
{
    public class OperatorInitiatedActionEventReport : MessageBody
    {
        public string MachineName { get; set; }
        public string CommandID { get; set; }
        public string CommandType { get; set; }
        public string CarrierID { get; set; }
        public string Source { get; set; }
        public string Destination { get; set; }
        public string Priority { get; set; }
        public string EventID { get; set; }

        public OperatorInitiatedActionEventReport()
            : base("OperatorInitiatedAction")
        { }

        public override System.Xml.Linq.XElement ToXElement()
        {
            XElement body = new XElement("Body");
            body.Add(new XElement("MACHINENAME", this.MachineName));
            body.Add(new XElement("COMMANDID", this.CommandID));
            body.Add(new XElement("COMMANDTYPE", this.CommandType));
            body.Add(new XElement("CARRIERID", this.CarrierID));
            body.Add(new XElement("SOURCE", this.Source));
            body.Add(new XElement("DESTINATION", this.Destination));
            body.Add(new XElement("PRIORITY", this.Priority));
            body.Add(new XElement("EVENTID", this.EventID));
            return body;
        }

        public override void Parse(System.Xml.Linq.XElement body)
        {
            this.MachineName = body.Element("MACHINENAME").Value;
            this.CommandID = body.Element("COMMANDID").Value;
            this.CommandType = body.Element("COMMANDTYPE").Value;
            this.CarrierID = body.Element("CARRIERID").Value;
            this.Source = body.Element("SOURCE").Value;
            this.Destination = body.Element("DESTINATION").Value;
            this.Priority = body.Element("PRIORITY").Value;
            this.EventID = body.Element("EVENTID").Value;
        }
    }
}
